﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace emp.Utility
{
    public class LogsUtil
    {
        public static void DoLog(string logMsg)//写日志的方法
        {
            try
            {
                DateTime now = DateTime.Today;
                string fileName = ConfigurationSettings.AppSettings["logs"]+"/" +now.Date.ToShortDateString().Replace("/", "") + "_logs.txt";
                System.IO.FileStream fs = System.IO.File.Open(fileName, System.IO.FileMode.Append);
                System.IO.StreamWriter writer = new System.IO.StreamWriter(fs, System.Text.Encoding.GetEncoding("GB2312"));
                string s = "\r\n" + "=====时间：" + DateTime.Now.ToString() + "=====";
                s = s + "\r\n" + logMsg;
                writer.Write(s);
                writer.Close();
                fs.Close();
            }
            catch
            {
            }
        }

    }
}
